using Godot;

namespace Arcane.Source.Combat.StatusEffects
{
    public class Mark(int duration, int dmgType) : TimerEffect(duration)
    {
        public readonly static StringName MODIFIER = "mark";
        public override void OnStack(ITrigger trigger)
        {
            if (trigger is not Mark m) return;

            _timer = m._timer;
        }

        public override void OnReady(Entity host)
        {
            host.AddModifier(MODIFIER, new Modifier
            {
                type = dmgType == 0 ? ModifierType.Hurt : ModifierType.MagicalHurt,
                op = ModifierOp.Mul,
                value = 0.2f,
            });
        }

        public override void OnRemove(Entity host)
        {
            host.RemoveModifier(MODIFIER);
        }
    }
}